package xian.woniu.web.controller;

import org.springframework.web.bind.annotation.*;
import xian.woniu.entity.Appointment;
import xian.woniu.service.IAppointmentService;
import xian.woniu.util.ResultVO;

/**
 * @author SongHang
 * @time 2022/07/04 19:25:03
 */
@RestController
@RequestMapping("appointment")
public class AppointmentController {
    private IAppointmentService appointmentService;

    public AppointmentController(IAppointmentService appointmentService) {
        this.appointmentService = appointmentService;
    }

    @GetMapping("findAll")
    public ResultVO findAll() {
        return ResultVO.success("查询成功！", appointmentService.findAll());
    }

    /**
     * 查询所有的预约记录包含个人信息
     * @return
     */
    @GetMapping("findAllWithMsg")
    public ResultVO findAllWithMsg() {
        return ResultVO.success("查询成功！", appointmentService.findAllWithMsg());
    }

    /**
     * 修改预约表
     */
    @PostMapping("update")
    public ResultVO update(@RequestBody Appointment appointment){
        appointmentService.update(appointment);
        return ResultVO.success("修改成功");
    }
}
